package com.example.dtos.plugin;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;

/**
 * 插件查询参数DTO
 */
public record PluginQueryDTO(
    @Schema(description = "插件状态筛选：all(全部)/enabled(已启用)/disabled(已禁用)", example = "enabled")
    String status,
    
    @Schema(description = "搜索关键词，搜索插件名称、ID或描述", example = "数据分析")
    String keyword,
    
    @Schema(description = "当前页码", defaultValue = "1", example = "1")
    @Min(value = 1, message = "页码最小为1")
    Integer page,
    
    @Schema(description = "每页条数", defaultValue = "10", example = "10")
    @Min(value = 1, message = "每页条数最小为1")
    Integer pageSize
) {
    /**
     * 规范构造函数，提供默认值
     */
    public PluginQueryDTO {
        status = status == null ? "all" : status;
        page = page == null ? 1 : page;
        pageSize = pageSize == null ? 10 : pageSize;
    }
} 